package socket2;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;

/**
 * @classname:ServiceTest
 * @description:
 * @author: Mr.Z
 * @date: 2020/12/21 19:34
 * @version: 0.1
 * @since:1.8
 */
public class ServiceTest {
    public static void main(String[] args) {
final String serverName = "server";
        try {
            ServerSocket serverSocket = new ServerSocket(7777);
            System.out.println("服务器端开启");
            while (true) {
                Socket accept = serverSocket.accept();
                new Thread(()->WriteOrReadMsg.readMsg(accept),serverName).start();
                new Thread(()->WriteOrReadMsg.writeMsg(accept),serverName).start();
            }

        } catch (IOException e) {

            e.printStackTrace();
        }


    }

}
